@(contentNode: spray.site.ContentNode)

<aside class="span3 sidebar">

  <div class="well" style="padding: 8px 0;">
    <ul class="nav nav-list">
      <li class="nav-header">@if(contentNode.parent.isRoot){Contents} else {@contentNode.parent.name}</li>

      @anchor(node: spray.site.ContentNode, icon: String) = {
        <a href="@node.absoluteUri"><i class="@icon"></i> @node.name</a>
      }

      @icon(icon: Int) = @{
        icon match {
          case 1 => "icon-book"
          case 2 => "icon-tag"
          case _ => "icon-chevron-right"
        }
      }

      @item(node: spray.site.ContentNode) = {
        @if(node == contentNode) {
          <li class="active">
            @anchor(node, "icon-white " + icon(node.level))
            @if(!node.isLeaf) {
              <ul class="nav nav-list">
                @node.children.map(item)
              </ul>
            }
          </li>
        } else {
          <li>@anchor(node, icon(node.level))</li>
        }
      }

      @contentNode.parent.children.map(item)

    </ul>
  </div>

</aside>